<?php

namespace App\Http\Controllers\Api\V1\Frontend;


use App\Http\Controllers\BaseController;
use App\Models\Advertisement;
use App\Models\Category;
use App\Transformers\Frontend\AdvertisementTransformer;
use App\Transformers\Frontend\CategoryTransformer;

class AdvertisementController extends BaseController
{

    /**
     * @api                         {get} /frontend/advertisement  轮播列表
     * @apiVersion                  1.0.0
     * @apiName                     load_advertisement
     * @apiGroup                    Advertisement
     * @apiDescription              轮播列表
     * @apiParam (get param)         {String='bannering'} [include] 获取关联信息 bannering:轮播图[path:文件路径];
     * @apiSuccess {Number}          status_code    (200) 状态码
     * @apiSuccess {Object}          data                               列表数组
     * @apiSuccess {Integer}         data.id                             ID
     * @apiSuccess {String}          data.name                          名称
     * @return \Dingo\Api\Http\Response
     */
    public function index()
    {
        $advertisements = Advertisement::all();
        return $this->response->collection($advertisements, new AdvertisementTransformer());
    }
}
